//
//  ViewController.m
//  11-23test
//
//  Created by mac on 15-11-23.
//  Copyright (c) 2015年 yb. All rights reserved.
//

#import "ViewController.h"
#import "InViewController.h"

@interface ViewController ()
{
    NSArray *data;
    NSArray *no;
}
@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    
    self.title = @"通讯录";
    data = @[
            @"尹彬",
            @"李梦杰",
            @"张鑫",
            @"汪晓",
            @"苏夏洪"
             ];
    no = @[
           @"123456789",
           @"234567891",
           @"345678912",
           @"456789123",
           @"567891234"
           ];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return data.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];
    cell.textLabel.text = data[indexPath.row];
    cell.detailTextLabel.text = no[indexPath.row];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    InViewController *con = [[InViewController alloc]initWithStyle:UITableViewStyleGrouped] ;
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    con.tel =cell.detailTextLabel.text;
    [self.navigationController pushViewController:con animated:YES];
}



- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
